home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00405_constructors new shortnames.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  6.5 KB  |  203 lines

  1. global gNewShortNameList
  2.  
  3. on hbuildshortname pListOFentries, pThisMode, pWriteToThis
  4.   set vTHeseEntries to []
  5.   set gNewList to [:]
  6.   set vPropertLIst to [:]
  7.   set vDUPlist to []
  8.   set gNewShortNameList to []
  9.   set vTHeseEntries to hReadIt(pListOFentries)
  10.   set vTHeseEntries to value(vTHeseEntries)
  11.   set vMax to count(vTHeseEntries)
  12.   set vThisLUList to hReadInLU(pThisMode)
  13.   repeat with x = 1 to vMax
  14.     set vthisPRop to getAt(vTHeseEntries, x)
  15.     set vNewShortName to hMakeShortName(vthisPRop, pThisMode)
  16.     add(gNewShortNameList, vNewShortName)
  17.     addProp(vPropertLIst, vNewShortName, vthisPRop)
  18.     hputmsg(vNewShortName)
  19.   end repeat
  20.   hputmsg("these are duplicates " && vDUPlist)
  21.   if pThisMode = #ENCY then
  22.     hWriteAlph(vPropertLIst, pWriteToThis)
  23.   else
  24.     hWriteThis(vPropertLIst, pWriteToThis)
  25.   end if
  26. end
  27.  
  28. on hCheckLUforFinalDups pThisCast
  29.   set vFixthese to []
  30.   set vCastList to value(the text of cast pThisCast)
  31.   repeat with x = 1 to count(vCastList)
  32.     set vShortName to getPropAt(vCastList, x)
  33.     set vHoldcount to 0
  34.     repeat with p = 1 to count(vCastList)
  35.       set vNextShortname to getPropAt(vCastList, p)
  36.       if vShortName = vNextShortname then
  37.         set vHoldcount to vHoldcount + 1
  38.         if vHoldcount > 1 then
  39.           add(vFixthese, vShortName)
  40.         end if
  41.       end if
  42.     end repeat
  43.   end repeat
  44.   hputmsg("these are dups fix them manually" && vFixthese)
  45. end
  46.  
  47. on hCheckLUforFinalDupsALL pThisCast, pEndCast
  48.   set vFixthese to []
  49.   repeat with z = pThisCast to pEndCast
  50.     set vCastList to value(the text of cast z)
  51.     repeat with x = 1 to count(vCastList)
  52.       set vShortName to getPropAt(vCastList, x)
  53.       set vHoldcount to 0
  54.       repeat with p = 1 to count(vCastList)
  55.         set vNextShortname to getPropAt(vCastList, p)
  56.         if vShortName = vNextShortname then
  57.           set vHoldcount to vHoldcount + 1
  58.           if vHoldcount > 1 then
  59.             add(vFixthese, vShortName)
  60.           end if
  61.         end if
  62.       end repeat
  63.     end repeat
  64.     hputmsg("these are dups fix them manually" && vFixthese)
  65.     hputmsg("working on cast num" && z - 1)
  66.   end repeat
  67. end
  68.  
  69. on hWriteAlph pthisString, pthisName
  70.   set gAlphText to [:]
  71.   set gtheText to [:]
  72.   repeat with p = charToNum("A") to charToNum("Z")
  73.     set gtheText to pthisString
  74.     sort(gtheText)
  75.     set vstartHere to numToChar(p)
  76.     set vendHere to numToChar(p + 1)
  77.     repeat with n = findPosNear(gtheText, vstartHere) to findPosNear(gtheText, vendHere) - 1
  78.       addProp(gAlphText, getPropAt(gtheText, n), getAt(gtheText, n))
  79.     end repeat
  80.     hWriteThis(gAlphText, pthisName & numToChar(p))
  81.     set gAlphText to [:]
  82.   end repeat
  83. end
  84.  
  85. on hWriteThis pthisString, pthisName
  86.   set pthisString to string(pthisString)
  87.   set gWriteObject to FileIO(mnew, "write", the pathName & pthisName)
  88.   set gtheText to pthisString
  89.   set newText to value(gtheText)
  90.   set reallyText to string(newText)
  91.   gWriteObject(mWriteString, reallyText)
  92.   gWriteObject(mdispose)
  93.   hputmsg("Wrote a file named " & pthisName & "******************" & RETURN)
  94. end
  95.  
  96. on hMakeShortName pThisLongName, pThisMode
  97.   set vCleanLongName to hZappedForShortNames(pThisLongName)
  98.   set vLengthLongName to length(vCleanLongName)
  99.   if pThisMode = #ENCY then
  100.     set vShortName to char 1 to 3 of vCleanLongName & char vLengthLongName - 1 to vLengthLongName of vCleanLongName & "B"
  101.     if length(vShortName) < 6 then
  102.       set vShortName to char 1 to 3 of vCleanLongName & char vLengthLongName - 1 to vLengthLongName of vCleanLongName & "_B"
  103.       if length(vShortName) < 6 then
  104.         hputmsg("‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢ less than six")
  105.       end if
  106.     end if
  107.   end if
  108.   if pThisMode = #CHRO then
  109.     if char 1 to 3 of vCleanLongName = "The" then
  110.       set vShortName to "C" & char 4 to 6 of vCleanLongName & char vLengthLongName - 1 to vLengthLongName of vCleanLongName
  111.       hputmsg("skipping the now is vShortName" && vShortName)
  112.     else
  113.       set vShortName to "C" & char 1 to 3 of vCleanLongName & char vLengthLongName - 1 to vLengthLongName of vCleanLongName
  114.     end if
  115.   end if
  116.   if pThisMode = #EPIS then
  117.     set vShortName to "E" & char 1 to 3 of vCleanLongName & char vLengthLongName - 1 to vLengthLongName of vCleanLongName
  118.   end if
  119.   return vShortName
  120. end
  121.  
  122. on hReadInLU pWhatMode
  123.   set gEntireLUList to hMakeListFromCast(641, 666)
  124.   set vBeginShortCastMem to the number of cast "LU_A_ENCY"
  125.   set vEndShortCastMem to the number of cast "LU_Z_ENCY"
  126.   if pWhatMode = #ENCY then
  127.     set vBeginCastMem to the number of cast "ATTRIB_A_ENCY"
  128.     set vEndCastMem to the number of cast "ATTRIB_Z_ENCY"
  129.   end if
  130.   if pWhatMode = #EPIS then
  131.     set vBeginCastMem to the number of cast "ATTRIB_A_EPIS"
  132.     set vEndCastMem to the number of cast "ATTRIB_3_EPISSUB"
  133.   end if
  134.   if pWhatMode = #CHRO then
  135.     set vBeginCastMem to the number of cast "ATTRIB_18_CHRO"
  136.     set vEndCastMem to the number of cast "ATTRIB_24_CHRO"
  137.   end if
  138.   set vThisLUList to hMakeListFromCast(vBeginShortCastMem, vEndShortCastMem)
  139.   return vThisLUList
  140. end
  141.  
  142. on hCheckForDupes pWhatShortName
  143.   set vLUlist to the text of cast ("LU_" & char 1 of pWhatShortName & "_ENCY")
  144.   set vLUlist to value(vLUlist)
  145.   set vValue to getaProp(vLUlist, pWhatShortName)
  146.   if stringp(vValue) then
  147.     return vValue
  148.   end if
  149. end
  150.  
  151. on hZappedForShortNames x
  152.   if voidp(x) then
  153.     return 
  154.   end if
  155.   set x to hZapThroughOut(x, 40)
  156.   set x to hZapThroughOut(x, 91)
  157.   set x to hZapThroughOut(x, 41)
  158.   set x to hZapThroughOut(x, 93)
  159.   set x to hZapThroughOut(x, 59)
  160.   set x to hZapThroughOut(x, 58)
  161.   set x to hZapThroughOut(x, 32)
  162.   set x to hZapThroughOut(x, 210)
  163.   set x to hZapThroughOut(x, 39)
  164.   set x to hZapThroughOut(x, 45)
  165.   set x to hZapThroughOut(x, 212)
  166.   set x to hZapThroughOut(x, 211)
  167.   set x to hZapThroughOut(x, 44)
  168.   set x to hZapThroughOut(x, 46)
  169.   set x to hZapThroughOut(x, 39)
  170.   set x to hZapThroughOut(x, 213)
  171.   set x to hZapThroughOut(x, 33)
  172.   set x to hZapThroughOut(x, 63)
  173.   set x to hZapThroughOut(x, 142)
  174.   set x to hZapThroughOut(x, 137)
  175.   set x to hZapSpecialCase(x)
  176.   return x
  177. end
  178.  
  179. on hWehaveaShortName pB, pE
  180.   set gOutLIST to []
  181.   hTHisList()
  182.   set gEntireNameList to hMakeListFromCast(pB, pE)
  183.   set gEntireNameList to value(gEntireNameList)
  184.   set vMax to count(gStevesList)
  185.   repeat with x = 1 to count(gStevesList)
  186.     set vthisPRop to getAt(gStevesList, x)
  187.     set vthisshortname to hChangetoShortorVOid(vthisPRop, gEntireNameList, gOutLIST)
  188.     hputmsg("this many left " & vMax - x)
  189.   end repeat
  190. end
  191.  
  192. on hChangetoShortorVOid vEntryName, vthisList, pOutputlist
  193.   set vthisList to value(vthisList)
  194.   set vValue to getaProp(vthisList, vEntryName)
  195.   if voidp(vValue) then
  196.     add(pOutputlist, vEntryName)
  197.   end if
  198.   hputmsg(pOutputlist)
  199. end
  200.  
  201. on hTHisList
  202. end
  203.